package com.yunjie.model;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.yunjie.model.tree.TreeModel;

/**
 * 公司档案实体类
 * @author yoyo
 *
 */
@Entity
@Table(name = "bd_corp", catalog = "new_manage")
public class ComProfile implements java.io.Serializable,TreeModel<ComProfile> {
	private static final long serialVersionUID = 3541535424305315638L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "parentid")
	private ComProfile comProfile;
	@Column(name = "code", length = 50)
	private String code;
	@Column(name = "fname", length = 150)
	private String fname;
	@Column(name = "level")
	private Integer level;
	@Column(name = "name", length = 150)
	private String name;
	@Column(name = "note")
	private String note;
	@Column(name = "opid")
	private Integer opid;
	@Column(name = "orgcode", length = 50)
	private String orgcode;
	@Column(name = "sname", length = 150)
	private String sname;
	@Column(name = "status", length = 11)
	private String status;
	@Column(name = "ts", length = 19)
	private Timestamp ts;
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "comProfile")
	private Set<ComProfile> comProfiles = new HashSet<ComProfile>(0);

	// Constructors

	/** default constructor */
	public ComProfile() {
	}

	/** full constructor */
	public ComProfile(ComProfile comProfile, String code, String fname, Integer level,
			String name, String note, Integer opid, String orgcode,
			String sname, String status, Timestamp ts, Set<ComProfile> comProfiles) {
		this.comProfile = comProfile;
		this.code = code;
		this.fname = fname;
		this.level = level;
		this.name = name;
		this.note = note;
		this.opid = opid;
		this.orgcode = orgcode;
		this.sname = sname;
		this.status = status;
		this.ts = ts;
		this.comProfiles = comProfiles;
	}
	
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	public ComProfile getComProfile() {
		return this.comProfile;
	}

	public void setComProfile(ComProfile comProfile) {
		this.comProfile = comProfile;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getFname() {
		return this.fname;
	}

	public void setFname(String fname) {
		this.fname = fname;
	}

	public Integer getLevel() {
		return this.level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNote() {
		return this.note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Integer getOpid() {
		return this.opid;
	}

	public void setOpid(Integer opid) {
		this.opid = opid;
	}

	public String getOrgcode() {
		return this.orgcode;
	}

	public void setOrgcode(String orgcode) {
		this.orgcode = orgcode;
	}

	public String getSname() {
		return this.sname;
	}

	public void setSname(String sname) {
		this.sname = sname;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Timestamp getTs() {
		return this.ts;
	}

	public void setTs(Timestamp ts) {
		this.ts = ts;
	}

	public Set<ComProfile> getComProfiles() {
		return this.comProfiles;
	}

	public void setComProfiles(Set<ComProfile> comProfiles) {
		this.comProfiles = comProfiles;
	}
	
	public Set<ComProfile> getChildrens() {
		return this.comProfiles;
	}
}